package singleInstance

/**
 * 单校验同步锁单例
 */
class SingleInstanceTwo private constructor() {
    companion object {
        private var instance: SingleInstanceTwo? = null
            get() {
                if (field == null) {
                    field = SingleInstanceTwo()
                }
                return field
            }

        @Synchronized
        fun instance(): SingleInstanceTwo {
            return instance!!
        }
    }

    fun print(str: String) {
        PrintUtil.print(str)
    }
}